package com.shell.governor.util;

import com.shell.bee.entity.auth.AuthOrgan;
import com.shell.bee.entity.auth.AuthRole;
import com.shell.governor.authorization.po.PubRole;
import com.shell.governor.organization.po.PubOrgan;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;

public class TransformHelper {
	public static AuthRole transformRole(PubRole role) {
		AuthRole authRole = new AuthRole();
		BeanUtils.copyProperties(role, authRole);
		return authRole;
	}

	public static List<AuthRole> transformRole(List<PubRole> roleList) {
		List<AuthRole> authRoleList = new ArrayList();
		for (PubRole role : roleList) {
			AuthRole authRole = new AuthRole();
			authRole = transformRole(role);
			authRoleList.add(authRole);
		}
		return authRoleList;
	}

	public static List<AuthRole> transformRoles(List<PubRole> roleList) {
		List<AuthRole> authRoleList = new ArrayList();
		for (PubRole role : roleList) {
			AuthRole authRole = new AuthRole();
			authRole = transformRole(role);
			authRoleList.add(authRole);
		}
		return authRoleList;
	}

	public static AuthOrgan transformOrgan(PubOrgan organ) {
		AuthOrgan authOrgan = new AuthOrgan();
		if (null != organ) {
			BeanUtils.copyProperties(organ, authOrgan);
		}
		return authOrgan;
	}
}